package cn.rocky.prepare;


import java.util.HashSet;
import java.util.Set;

public class isUnique {

    public boolean isUnique(String astr) {
        char[] chars = astr.toCharArray();
        boolean flag = true;
        Set<Object> set = new HashSet<>();
        for (int i = 0; i < chars.length; i++) {
            if (set.contains(chars[i])) {
                flag = false;
                break;
            } else {
                set.add(chars[i]);
            }
        }
        return flag;
    }
}
